package com.flute.icrawler.app.processor.store;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.flute.icrawler.app.processor.AbstractProcessor;
import com.flute.icrawler.app.service.CrawlService;
import com.flute.icrawler.framework.framework.CrawlUrl;
import com.flute.icrawler.framework.processor.result.NotificationProcessorResult;

/**
 * 数据通知器 负责给进行了监听的模块发通知
 * 
 * @author jiangbo
 * 
 */
public class CrawlUrlInformer extends AbstractProcessor {

	private String filterReg = "";

	private String matchReg = "";

	private static final Logger LOGGER = LoggerFactory
			.getLogger(CrawlUrlInformer.class);

	@Override
	public void process(CrawlUrl url) {
		// TODO Auto-generated method stub

		if (CrawlService.match(url.getUrl(), filterReg, matchReg)) {
			LOGGER.debug("unmatch url=" + url.getUrl() + filterReg + " "
					+ matchReg);
			return;
		}

		url.registerProcessorResult(new NotificationProcessorResult());

	}

}
